home *** CD-ROM | disk | FTP | other *** search
/ Software Vault: The Diamond Collection / The Diamond Collection (Software Vault)(Digital Impact).ISO / cdr05 / wet101.zip / DLLAPP.CPP next >
C/C++ Source or Header  |  1994-05-15  |  3KB  |  89 lines

  1. #include <owl\applicat.h>
  2. #include <owl\framewin.h>
  3.  
  4. #include "WET.HPP"
  5.  
  6.  
  7. // Application class declaration.
  8. class TApp : public TApplication
  9. {
  10. public:
  11.     TApp(): TApplication() {}
  12.     void InitMainWindow();
  13. };
  14.  
  15. // The main window class.
  16. class TWndw: public TFrameWindow
  17. {
  18. public:
  19.     TWndw(TWindow *parent, const char far *title);
  20.  
  21. protected:
  22.  
  23. };
  24.  
  25.  
  26. ///////////////////////////////////////////////////////////
  27. // TWndw::TWndw()
  28. //
  29. // This is the main window's constructor.
  30. ///////////////////////////////////////////////////////////
  31. TWndw::TWndw(TWindow *parent, const char far *title) :
  32.     TFrameWindow(parent, title)
  33. {
  34.     // Set the window's size.
  35.     Attr.X = 40;
  36.     Attr.Y = 40;
  37.     Attr.H = GetSystemMetrics(SM_CYSCREEN) / 1.5;
  38.     Attr.W = GetSystemMetrics(SM_CXSCREEN) / 1.5;
  39. }
  40.  
  41. ///////////////////////////////////////////////////////////
  42. // TApp::InitMainWindow()
  43. //
  44. // This function creates the application's main window.
  45. ///////////////////////////////////////////////////////////
  46. void TApp::InitMainWindow()
  47. {
  48.   TFrameWindow *wndw = new TWndw(0, "DLL Test Window");
  49.   SetMainWindow(wndw);
  50.   int block_length;
  51.   unsigned char block[100];
  52.   unsigned char code_key[9]="Test Key";
  53.   lstrcpy(block,"This is a test 0123456789");
  54.   block_length=16;  // just encrypt 1st 16 characters
  55.   MessageBox(wndw->HWindow,"This demo shows how well WET protects your data.","Encryption Demo",MB_OK);
  56.   MessageBox(wndw->HWindow,block,"Encryption test - Clear text",MB_ICONEXCLAMATION);
  57.   EncryptXORBlock(block,block_length,code_key);
  58.   EncryptTranspositionBlock(block,block_length,code_key);
  59.   EncryptSubstitutionBlock(block,block_length,code_key);
  60.   MessageBox(wndw->HWindow,block,"Encryption test - Encrypted (1st 16 char)",MB_ICONEXCLAMATION);
  61.   EncryptSubstitutionBlock(block,block_length,code_key);
  62.   EncryptTranspositionBlock(block,block_length,code_key);
  63.   EncryptXORBlock(block,block_length,code_key);
  64.   MessageBox(wndw->HWindow,block,"Encryption test - Decrypted",MB_ICONEXCLAMATION);
  65.   /*
  66.   For a DES example you could use:
  67.   unsigned char work_string[100];
  68.   unsigned char use_key[8]={'0','1','2','3','4','5','6','7'};
  69.   lstrcpy(work_string,"This is a test 0123456789");
  70.   MessageBox(wndw->HWindow,work_string,"DES Encryption test - Clear Text",MB_ICONEXCLAMATION);
  71.   DESKeyloadEncrypt(use_key);
  72.   EncryptDESBlockCBC(work_string,16);
  73.   MessageBox(wndw->HWindow,work_string,"DES Encryption test - DES Encrypted (1st 16 char)",MB_ICONEXCLAMATION);
  74.   DESKeyloadDecrypt(use_key);
  75.   DecryptDESBlockCBC(work_string,16);
  76.   MessageBox(wndw->HWindow,work_string,"DES Encryption test - Decrypted",MB_ICONEXCLAMATION);
  77.   */
  78.   _exit(0);
  79. }
  80.  
  81. ///////////////////////////////////////////////////////////
  82. // OwlMain()
  83. ///////////////////////////////////////////////////////////
  84. int OwlMain(int, char*[])
  85. {
  86.   return TApp().Run();
  87. }
  88.  
  89.